@extends('admin.layout')

@section('content_header')
    contact info
@stop

@section('content')

    <div>
        
        <form action="{{route('admin.contact.index')}}">
            <div class="d-flex py-3 align-items-center">
                <div class="p-2"> 姓 <input type="text" name="first_name" value="{{request()->first_name??''}}"></div>
                <div class="p-2"> 名 <input type="" name="last_name" value="{{request()->last_name??''}}"></div>
                <div class="p-2"> 携帯電話番号 <input type="" name="mobile" value="{{request()->mobile??''}}"></div>
                <div class="p-2"> 電話番号 <input type="" name="tel" value="{{request()->tel??''}}"></div>
                 <div class="p-2"> 優先連絡日付 <input  name="first_contact_date" type="date" value="{{request()->first_contact_date??''}}"></div>
                 <div class="p-2"><button class="btn btn-info" type="submit">search</button></div>
            </div>
        </form>
    </div>

    <table class="table table-bordered">
    	
    	<thead>
    		<th>姓</th>
    		<th>名</th>
            <th>生年月日</th>
    		<th>自宅郵便番号</th>
    		<th>自宅住所</th>
            <th>電子メールアドレス</th>
            <th>携帯電話番号</th>
            <th>電話番号</th>
            <th>優先連絡日付</th>
            <th>再選連絡日付</th>
            <th>伝言内容</th>
            <th></th>
    	</thead>
    	<tbody>
    		
    		@foreach($datas as $v)
    			<tr>
    				
    				<td>{{$v->first_name}}</td>
    				<td>{{$v->last_name}}</td>
                    <td>{{ $v->bod }}</td>
                    <td>{{ $v->zip }}</td>
                    <td>{{ $v->pref }}</td>
                    <td>{{ $v->email }}</td>
                    <td>{{ $v->mobile }}</td>
                    <td>{{ $v->tel }}</td>
                    <td>{{ implode(' ',$v->first_contact_date) }}</td>
                    <td>{{ implode(' ', $v->second_contact_date) }}</td>
                    <td>@if($v->message) <a href="javascript:;" class="far fa-eye text-secondary" data-toggle="popover" data-content="{{$v->message}}"></a> @endif</td>
    				
    				<td>
                        <a href="javascript:;" class="far fa-trash-alt text-secondary" data-url="{{route('admin.contact.destroy', $v)}}"></a>
    				</td>
    			</tr>
    		@endforeach
    	</tbody>
    </table>
    <p>{{$datas->appends(request()->query())->links()}}</p>
@stop

@section('js')
@parent
<script>
    $(function () {
          $('[data-toggle="popover"]').popover()
    })
</script>
    
@endsection